//
//  ViewController.m
//  3-3
//
//  Created by mac on 16-3-3.
//  Copyright (c) 2016年 mac. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (retain, nonatomic) IBOutlet UIImageView *myimageview;
-(IBAction)rangHero;

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)rangHero
{
    //1.获取一个1-24的随机数
    int imageId = arc4random()%24+1;
    //2.创建图片名字字符串
    NSString * imageName = [NSString stringWithFormat:@"%d.jpg",imageId];
    //3.加载随机图片到iamgeView控件上
    self.myimageview.image = [UIImage imageNamed:imageName];
}
- (void)dealloc {
    [_myimageview release];
    [super dealloc];
}
@end
